package com.company.pangu.sensitive.strategy;

import com.company.pangu.sensitive.enums.SensitiveDefaultLengthEnum;
import com.company.pangu.sensitive.util.SensitiveInfoUtils;

/**
 * 手机号码脱敏
 *
 * @author youyoukele
 * @version 1.0
 * @date 2022/09/05 10:34
 */
public class SensitiveMobile implements IStrategy {

    @Override
    public String desensitization(String mobile, int begin, int end) {
        if (begin != SensitiveDefaultLengthEnum.MOBILE.getBegin() && begin != 0 &&
                end != SensitiveDefaultLengthEnum.MOBILE.getEnd() && end != 0) {
            return SensitiveInfoUtils.mobilePhone(mobile, begin, end);
        }
        return SensitiveInfoUtils.mobilePhone(mobile, SensitiveDefaultLengthEnum.MOBILE.getBegin(), SensitiveDefaultLengthEnum.MOBILE.getEnd());
    }

}
